home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / pcrsep89.arc / CA.BI < prev    next >
Text File  |  1990-03-21  |  5KB  |  123 lines

  1. '  Include this file at the beginning of every Quick Basic program.
  2.  
  3. '******************
  4. ' CAINIT initializes the Cellular Automaton library and selects a video mode
  5. '    Mode 1: Monochrome text, alter & display character values
  6. '    Mode 2: Monochrome text, alter & display attribute values
  7. '    Mode 3: CGA text, alter & display character values
  8. '    Mode 4: CGA text, alter & display attribute values
  9. '    Mode 5: CGA 4-color graphics, 320 x 200 display
  10. '    Mode 6: EGA/VGA 16-color graphics, 640 x 350 display (256K EGA/VGA only)
  11. '  Note: it is your responsiblity to pick modes which your video apapter
  12. '        and monitor support.  The library does not check your hardware
  13. '        for you.
  14. '  The second parameter is usually specified as VARPTR(CaArray(0)) unless
  15. '  you have a reason to use a different array.
  16. '******************
  17. DECLARE FUNCTION CAINIT% (BYVAL Modenum%, BYVAL ArrayPtr%)
  18.  
  19. '******************
  20. ' CARESET returns the video system to its starting mode
  21. '******************
  22. DECLARE SUB CARESET ()
  23.  
  24. '******************
  25. ' CAWRAP allows or diallows left-to-right wrap around of the
  26. '   universe.  When wrap is allowed, cells at the far right side of
  27. '   the display are neighbors of those on the far left and vice versa.
  28. '   CAWRAP (0) turns off wrap-around (the default)
  29. '   CAWRAP (any non-zero value) turns on wrap-around
  30. '******************
  31. DECLARE SUB CAWRAP (BYVAL LogicalValue%)
  32.  
  33. '******************
  34. ' CABORDER sets the value used in the border cells.  The top and bottom
  35. '   border cells always exist.  Left and right border cells only exist
  36. '   if wrap-around is turned off.  BorderValue% must be < 256.
  37. '******************
  38. DECLARE SUB CABORDER (BYVAL BorderValue%)
  39.  
  40. '******************
  41. ' CACHAR sets, in text modes, the default or 'empty' character used in 
  42. '   the display. It has no effect on graphics modes.  By default, this
  43. '   value is a space character (ASCII 32). ClearChar% must be < 256.
  44. '******************
  45. DECLARE SUB CACHAR (BYVAL ClearChar%)
  46.  
  47. '******************
  48. ' CACOLOR.  In text modes, this sets the background attribute value. In
  49. '   color modes, it sets the background color.  By default, this is set
  50. '   to 7 (white on black) in text modes and 0 in color modes.
  51. '   ClearColor% must be < 256.
  52. '******************
  53. DECLARE SUB CACOLOR (BYVAL ClearColor%)
  54.  
  55. '******************
  56. ' CACLEAR clears both the buffer and display and resets them to their
  57. '   'empty' values.
  58. '******************
  59. DECLARE SUB CACLEAR ()
  60.  
  61. '******************
  62. ' CASIZE in graphics modes sets the number of rows and columns in the 
  63. '    unvierse, and number of times each cell's value is repeated both
  64. '    vertically and horizontally on the display.  It is your responsibility
  65. '    to be sure that (Rows + 4) * (Cols +2) <= 65536,
  66. '               that (Rows * RowRepeat) <= vertical size of your screen
  67. '           and that (Cols * ColRepeat) <= horizontal size of your screen
  68. '    for the graphics mode you have selected with CAINIT.
  69. '******************
  70. DECLARE SUB CASIZE (BYVAL Rows%,BYVAL Cols%,BYVAL RowRepeat%,BYVAL ColRepeat%)
  71.  
  72. '******************
  73. ' CASHOW will display the present contents of the universe on your screen.
  74. '******************
  75. DECLARE SUB CASHOW ()
  76.  
  77. '******************
  78. ' CASET will directly set values in the universe buffer.  Use it to set
  79. '   a starting configuration before you start the universe in motion.
  80. '   The values set with CASET will not appear on the screen until you
  81. '   call CASHOW
  82. '******************
  83. DECLARE SUB CASET (BYVAL Row%, BYVAL Column%, BYVAL Value%)
  84.  
  85. '******************
  86. ' CAGEN creates one new generation of your universe and displays in on
  87. '   the screen.  It makes repeated calls to CACELL, your rule function,
  88. '   to find the new value of each cell in the universe.
  89. '******************
  90. DECLARE SUB CAGEN ()
  91.  
  92. '******************
  93. ' CACELL is a function you write to determine the value a cell should
  94. '   have in the next generation.  The shorter and faster this function
  95. '   is, the faster your program will run.
  96. '******************
  97. DECLARE FUNCTION CACELL% ()
  98.  
  99. '******************
  100. ' CaArray is the array which contains information about one cell and
  101. '   its neighbors each time CACELL is called.  The constants below
  102. '   describe how information is stored in the array.  The array must
  103. '   be declared as STATIC, SHARED, and COMMON as shown.
  104. '******************
  105.  
  106. ' $STATIC
  107. DIM SHARED CaArray%(10)
  108. COMMON CaArray%()
  109.  
  110. '  Positions in the Array
  111. CONST NorthWest = 0
  112. CONST North     = 1
  113. CONST NorthEast = 2
  114. CONST West      = 3
  115. CONST Self      = 4
  116. CONST East      = 5
  117. CONST SouthWest = 6
  118. CONST South     = 7
  119. CONST SouthEast = 8
  120. CONST SelfRow   = 9
  121. CONST SelfCol   =10
  122.  
  123.